'Imports System.Xml 
Public Class KetNoiDto
    Inherits AbstractDto
#Region "Attributes"
    Private _Chuoi_ketnoi As String
    Private _MsSql As Integer
    Public _server As String
    Public _DataBase As String
    Public _username As String
    Public _pass As String
#End Region
#Region "Property"
    Public Property ChuoiKetNoi() As String
        Get
            Return _Chuoi_ketnoi
        End Get
        Set(ByVal value As String)
            _Chuoi_ketnoi = value
        End Set
    End Property
    Public Property MsSql() As Integer
        Get
            Return _MsSql
        End Get
        Set(ByVal value As Integer)
            _MsSql = value
        End Set
    End Property
#End Region
#Region "Contructor"
    Public Sub New(Optional ByVal XMl As Boolean = False)
        MsSql = 1
        'If XMl = True Then 
        'GetConnectionString(System.Web.HttpContext.Current.Server.MapPath("App_Data") + "/csdlxml/connect.xml ")
        'Else 
        ' ChuoiKetNoi = ""
        'End If 
    End Sub
    Public Sub New(ByVal str As String, Optional ByVal strsql As String = "")
        If str <> "" Then
            MsSql = str.Substring(0, 1)
            _DataBase = str.Substring(1, str.Length - 1)
            Select Case MsSql
                Case Class_KieuDL.Access
                    Dim Acc As New AccessDto(str.Substring(1, str.Length - 1), "MinhLam20")
                    ChuoiKetNoi = Acc.ChuoiKetNoi
                Case Class_KieuDL.SqlCe
                    Dim sqlce As New SqlCedto(str.Substring(1, str.Length - 1), "MinhLam20")
                    ChuoiKetNoi = sqlce.ChuoiKetNoi
                Case Class_KieuDL.sqlExpress
                    Dim sqlExp As New SqlExpressdto(str.Substring(1, str.Length - 1))
                    ChuoiKetNoi = sqlExp.ChuoiKetNoi
                Case Class_KieuDL.sql, Class_KieuDL.Oracle
                    ChuoiKetNoi = strsql
            End Select
        End If
    End Sub
#End Region
#Region "Contructor"
    Public Function Chuoiluu()
        Dim str As String = MsSql & _DataBase
        Return str
    End Function
    'Public Sub GetConnectionString(ByVal PathFileName As String)
    'Dim xmlReader As XmlTextReader = Nothing 
    'Dim sElementName As String = ""
    'Dim sConnectionString As String = ""
    'Dim sFileName As String = PathFileName
    'xmlReader = New XmlTextReader(sFileName.Trim())
    'While xmlReader.Read()
    'If xmlReader.NodeType = XmlNodeType.Element Then
    'sElementName = xmlReader.Name.Trim().ToUpper()
    'ElseIf xmlReader.NodeType = XmlNodeType.Text Then
    'If sElementName.Trim().ToUpper() = "CHUOIKETNOI" Then
    'sConnectionString = xmlReader.Value 
    'End If
    'End If
    'End While 
    'If xmlReader.ReadState <> ReadState.Closed Then
    'xmlReader.Close()
    'End If
    'ChuoiKetNoi = sConnectionString
    'End Sub
#End Region
End Class
